package cn.hxzy.teacher.examination.web;

import cn.hxzy.common.response.R;
import cn.hxzy.teacher.examination.pojo.ExaminationDetail;
import cn.hxzy.teacher.examination.service.examinationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/examination")
public class examinationController {

    @Autowired
    private examinationService examinationservice;
    //根据标签查询题库
    //获取所属专业的所有试题
    @PostMapping("/selectsubject")
    public R seletSubject(@RequestBody Map map){
        System.out.println("map:"+map);
        Map maps1 = examinationservice.selectsubjects01(map);
        System.out.println("maps1:"+maps1);
            return R.success(maps1);
    }
    @GetMapping("/selectsubjects")
    public R seletSubject2(){
        List<Map> maps = examinationservice.selectSubject2();
        return R.success(maps);
    }

    @GetMapping("/directions")
    public R getDirections() {
        List<Map> maps = examinationservice.selectDirections();
        return R.success(maps);
    }

    //新增试卷
    @RequestMapping("/examination")
    public R insertExamination(@RequestBody  Map map){
            int i = examinationservice.insertExamination(map);
            return R.success(i);
    }
    //查询所有标签
    @GetMapping("/selectalltag/{major_id}")
    public R selectAllTag(@PathVariable Integer major_id){
        List<Map> maps = examinationservice.selectAllTag(major_id);
        return R.success(maps);
    }
    //查询某试卷的基础信息以及试题
    @GetMapping("/selectexamination/{examination_id}")
    public R selectExamination(@PathVariable Integer examination_id){
        ExaminationDetail examinationDetail = examinationservice.selectExamination(examination_id);
        return R.success(examinationDetail);
    }
    // 查询总记录数

}
